package com.project.harmonyledger.common.response;

import lombok.Getter;

@Getter
public enum ResultCode {
  SUCCESS(200, "success"),

  // 客户端错误 4xx
  BAD_REQUEST(400, "请求参数错误"),
  UNAUTHORIZED(401, "未登录或登录已过期"),
  FORBIDDEN(403, "没有操作权限"),
  NOT_FOUND(404, "请求的资源不存在"),

  // 用户相关错误 1000~1999
  USER_NOT_FOUND(1000, "用户不存在"),
  USER_EXISTS(1001, "用户名已存在"),
  PASSWORD_ERROR(1002, "密码错误"),
  USERNAME_EMPTY(1003, "用户名不能为空"),
  PASSWORD_EMPTY(1004, "密码不能为空"),
  PASSWORD_NOT_MATCH(1005, "两次输入的密码不一致"),
  USER_UPDATE_FAILED(1006, "用户信息更新失败"),

  // 账户相关错误 2000~2999
  ACCOUNT_NOT_FOUND(2000, "账户不存在"),
  ACCOUNT_EXISTS(2001, "该用户已存在该类型账户"),
  BALANCE_NOT_ENOUGH(2002, "账户余额不足"),

  // 交易相关错误 3000~3999
  TRANSACTION_NOT_FOUND(3000, "交易记录不存在"),
  INVALID_AMOUNT(3001, "无效的交易金额"),

  // 系统错误 5xx
  SYSTEM_ERROR(500, "系统内部错误"),
  SERVICE_UNAVAILABLE(503, "服务不可用"),

  // 文件相关错误 4000~4999
  UPLOAD_FAILED(4000, "文件上传失败"),
  INVALID_FILE_TYPE(4001, "不支持的文件类型"),
  FILE_SIZE_EXCEEDED(4002, "文件大小超出限制"),
  PARTIAL_UPLOAD_FAILED(4003, "部分文件上传失败");

  private final int code;
  private final String message;

  ResultCode(int code, String message) {
    this.code = code;
    this.message = message;
  }
}